home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / news / thor / rexx / undeleterange.thor < prev    next >
Text File  |  1998-05-24  |  3KB  |  108 lines

  1. /* UndeleteRange.thor by Troels Walsted Hansen <troelsh@powertech.no>
  2. ** $VER: UndeleteRange.thor 1.0 (1.8.95)
  3. **
  4. ** Undelete a specified range of messages.
  5. */
  6.  
  7. options results
  8.  
  9. /* needs THOR and bbsread.library functions */
  10.  
  11. p = ' ' || address() || ' ' || show('P',,)
  12. thorport = pos(' THOR.',p)
  13.  
  14. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  15. else
  16. do
  17.     say 'No THOR port found!'
  18.     exit 10
  19. end
  20.  
  21. if ~show('p', 'BBSREAD') then
  22. do
  23.     address command
  24.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  25.         "WaitForPort BBSREAD"
  26. end
  27.  
  28. /* get info on messages */
  29.  
  30. address(bbsread)
  31. GETGLOBALDATA stem GLOBALDATA
  32.  
  33. address(thorport)
  34. GETGLOBALCONFIG stem GLOBALCONFIG
  35. CURRENTBBS stem CURRENT
  36.  
  37. if(CURRENT.CONFNAME = "") then
  38. do
  39.     address(bbsread)
  40.         GETCONFLIST '"'CURRENT.BBSNAME'"' CONFLIST
  41.     if(rc ~= 0) then
  42.     do
  43.         address(thorport)
  44.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  45.         exit 5
  46.     end
  47.  
  48.     address(thorport)
  49.     REQUESTLIST instem CONFLIST title '"Select conf:"' SIZEGADGET
  50.     if(rc ~= 0) then exit
  51.     else CURRENT.CONFNAME = result
  52. end
  53.  
  54. address(bbsread)
  55. GETCONFDATA bbsname '"'CURRENT.BBSNAME'"' confname '"'CURRENT.CONFNAME'"' stem CONFDATA
  56.  
  57. /*
  58. if(CONFDATA.FIRSTMSG < 1 | CONFDATA.LASTMSG < 1) then exit
  59.  
  60. address(thorport)
  61. REQUESTINTEGER MIN '"'CONFDATA.FIRSTMSG'"' MAX '"'CONFDATA.LASTMSG'"' INIT '"'CONFDATA.FIRSTMSG'"' TITLE '"First message in range:"' BT '"_Ok|_Cancel"'
  62. firstmsg = result
  63. if(rc ~= 0 | firstmsg = "RESULT") then exit
  64.  
  65. REQUESTINTEGER MIN '"'firstmsg'"' MAX '"'CONFDATA.LASTMSG'"' INIT '"'CONFDATA.LASTMSG'"' TITLE '"Last message in range:"' BT '"_Ok|_Cancel"'
  66. lastmsg = result
  67. if(rc ~= 0 | lastmsg = "RESULT") then exit
  68. */
  69.  
  70.  
  71. address(thorport)
  72. REQUESTINTEGER MIN '"1"' MAX '"9999999"' INIT '"'CONFDATA.FIRSTMSG'"' TITLE '"First message in range:"' BT '"_Ok|_Cancel"'
  73. firstmsg = result
  74. if(rc ~= 0 | firstmsg = "RESULT") then exit
  75.  
  76. REQUESTINTEGER MIN '"'firstmsg'"' MAX '"9999999"' INIT '"'CONFDATA.LASTMSG'"' TITLE '"Last message in range:"' BT '"_Ok|_Cancel"'
  77. lastmsg = result
  78. if(rc ~= 0 | lastmsg = "RESULT") then exit
  79.  
  80. /* undelete the messages with a progressbar */
  81.  
  82. OPENPROGRESS TITLE '"' || 'Deleting messages from ' || CURRENT.CONFNAME || '"' TOTAL lastmsg-firstmsg+1 AT '"_Abort"'
  83. if(rc = 0) then
  84. do
  85.     window = result
  86.  
  87.     do i=firstmsg to lastmsg
  88.         address(thorport)
  89.         UPDATEPROGRESS REQ window CURRENT i-firstmsg+1 PT '"' || 'Deleting message #' || i || '"'
  90.         if(rc ~= 0) then
  91.         do
  92.             address(thorport)
  93.             CLOSEPROGRESS REQ window
  94.             exit
  95.         end
  96.  
  97.         address(bbsread)
  98.         UPDATEBRMESSAGE '"'CURRENT.BBSNAME'"' '"'CURRENT.CONFNAME'"' i CLEARDELETED
  99.     end
  100. end
  101.  
  102. address(thorport)
  103. CLOSEPROGRESS REQ window
  104. SHOWCONFERENCE '"'CURRENT.CONFNAME'"'
  105. UPDATECONFWINDOW
  106.  
  107. exit
  108.